API & Database Reference
This document provides a detailed overview of NAVIGO’s database structure, API endpoints, and authentication rules.
Note: All protected endpoints require a valid Firebase Authentication token.
Database Structure
NAVIGO uses Firebase Firestore as the primary database. Below is a summary of the main collections and their fields:
1. Users Collection
- Collection:
users
- Document ID:
userId
- Fields:
email
(string) – User email addressname
(string) – Full namepoints
(number) – Accumulated points from completing quests
2. Quests Collection
- Collection:
quests
- Document ID:
questsId
- Fields:
title
(string) – Quest titledescription
(string) – Quest descriptionbuilding
(string) – Associated building or locationrewardPoints
(number) – Points awarded upon completionstatus
(string) – Quest status (active
orcompleted
)createdAt
(timestamp) – Quest creation timeupdatedAt
(timestamp) – Last update time
3. Collectibles Collection
- Collection:
collectibles
- Document ID:
collectiblesId
- Fields:
name
(string) – Name of the badge or itemdescription
(string) – Brief description of the collectibleiconUrl
(string) – URL for the collectible icon
4. Leaderboards Collection
- Collection:
leaderboards
- Document ID:
leaderboardsId
- Fields:
ranks
(array) – List of user scores and rankings
Authentication
NAVIGO uses Firebase Authentication to manage user sign-up and sign-in. Users can register with:
- Email & Password
- Google Sign-In (optional)
Password Requirements
Users cannot complete registration until the password meets all requirements:
- Minimum length: 8 characters
- Maximum length: 30 characters
- Must include:
- At least one uppercase character
- At least one lowercase character
- At least one numeric character
- At least one special character
If a user attempts to sign up with a non-compliant password, registration will fail, and they must update their password to meet the policy.
Example API Endpoints (Reference)
Quests
POST /api/quests
– Create a new questGET /api/quests
– Retrieve all questsPUT /api/quests/:id
– Update quest detailsDELETE /api/quests/:id
– Delete a quest
Collectibles
POST /api/collectibles
– Add a new badge or itemGET /api/collectibles
– Get all collectiblesPUT /api/collectibles/:id
– Update a collectibleDELETE /api/collectibles/:id
– Remove a collectible
Leaderboard
GET /api/leaderboard
– Fetch leaderboard standingsPUT /api/leaderboard/:userId
– Update a player’s score
Location Verification
POST /api/location/verify
– Confirm user reached a quest location
This structure ensures clarity, security, and real-time tracking of quests, rewards, and player progress in NAVIGO.